# -*- coding:utf-8 -*-
# @Author    : g1879
# @date      : 2020-11-17
# @email     : g1879@qq.com
from ListPage import Xpaths, Targets, ListPage

url = ('https://xueshu.baidu.com/s?wd=python&pn=0&tn=SE_baiduxueshu_c1gjeupa&ie=utf-8'
       '&sc_f_para=sc_tasktype%3D%7BfirstSimpleSearch%7D&sc_hit=1')

xpaths = Xpaths()
xpaths.rows = '//div[@class="sc_content"]'
xpaths.set_col('标题', './/a')

targets = Targets(xpaths)
targets.add_target('标题', '标题')
targets.add_target('标题', '标题', 'href')

p = ListPage(xpaths, url)
p.first_num = 0
p.step = 10
p.num_param = 'pn'

p.get_list(targets, begin_page=3, count=3)
